--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit b60cde6e4f808f460d24c1d1de1f1b538851f695
Parents : 80b8ca0
Author : Mark Qvist <mark@unsigned.io>
Date : 2022-09-28T13:12:14+02:00
Work on service class
Changes
3 files changed, 16 insertions(+), 2 deletions(-)
Diff
diff --git a/sbapp/patches/PythonService.java b/sbapp/patches/PythonService.java
index 35440734..41b59b38 100644
--- a/sbapp/patches/PythonService.java
+++ b/sbapp/patches/PythonService.java
@@ -145,6 +145,7 @@ public class PythonService extends Service implements Runnable {
builder.setContentText("Reticulum Running");
builder.setContentIntent(pIntent);
+ // TODO: Generalise this
Bitmap icon_bitmap = BitmapFactory.decodeFile("/data/user/0/io.unsigned.sideband/files/app/assets/notification_icon.png");
Icon service_icon = Icon.createWithBitmap(icon_bitmap);
// builder.setSmallIcon(context.getApplicationInfo().icon);
diff --git a/sbapp/services/sidebandservice.py b/sbapp/services/sidebandservice.py
index a048d218..b3625d34 100644
--- a/sbapp/services/sidebandservice.py
+++ b/sbapp/services/sidebandservice.py
@@ -6,6 +6,20 @@ from jnius import autoclass, cast
Context = autoclass('android.content.Context')
+class RnsService():
+ def __init__(self):
+ pass
+
+ def start(self):
+ pass
+
+ def stop(self):
+ pass
+
+ def restart(self):
+ self.stop()
+ self.start()
+
class sidebandservice():
def __init__(self):
diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py
index 767d98ed..c504696f 100644
--- a/sbapp/sideband/core.py
+++ b/sbapp/sideband/core.py
@@ -707,7 +707,6 @@ class SidebandCore():
def __start_jobs_immediate(self):
# TODO: Reset loglevel
self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=7)
- RNS.log("Reticulum started, activating LXMF...")
if RNS.vendor.platformutils.get_platform() == "android":
if not self.reticulum.is_connected_to_shared_instance:
@@ -818,7 +817,7 @@ class SidebandCore():
RNS.log("Error while adding I2P Interface. The contained exception was: "+str(e))
self.interface_i2p = None
-
+ RNS.log("Reticulum started, activating LXMF...")
self.message_router = LXMF.LXMRouter(identity = self.identity, storagepath = self.lxmf_storage, autopeer = True)
self.message_router.register_delivery_callback(self.lxmf_delivery)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────